package com.example.yjhero.safeapp.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.example.yjhero.safeapp.R;

public class Setpswdialog extends Dialog implements View.OnClickListener{
    private TextView mTitleTV;
    private EditText mFirstPWDET;
    private EditText mAffirmET;
    private MyCallBack mMyCallBack;


    public Setpswdialog( Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.dialog_setting_password);
        super.onCreate(savedInstanceState);

        initview();

    }

    public void setmTitleTV(TextView mTitleTV) {
        this.mTitleTV = mTitleTV;
    }

    public void setmMyCallBack(MyCallBack CallBack) {
        this.mMyCallBack = CallBack;
    }

    public String getmFirstPWDET() {
        return mFirstPWDET.getText().toString().trim();
    }

    public String getmAffirmET() {
        return mAffirmET.getText().toString().trim();
    }

    private void initview() {

        mTitleTV = findViewById(R.id.tv_setuppwd_title);
        mFirstPWDET = findViewById(R.id.et_firstpwd);
        mAffirmET = findViewById(R.id.et_affirm_password);
        findViewById(R.id.btn_ok).setOnClickListener(this);
        findViewById(R.id.btn_cancle).setOnClickListener(this);
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn_ok:
                mMyCallBack.ok();
                break;
            case R.id.btn_cancle:
                mMyCallBack.cancel();
                break;
        }

    }
/**
 * 定义接口以及方法
 * */
    public  interface MyCallBack{
        void ok();
        void cancel();
    }
}
